// JavaScript Document

var jq = jQuery.noConflict();

jQuery(function() {
	leftlist();
	NewsTop5();
	
/*	 leilist();
*/	 /*buyCar();*/
});
var id = 0;
var id2 = 0;
var id3 = 0;
var i4 = "";
var i2 = "";
function jq2(){
	jq(".leftNav ul li").hover(
		function(){
			id=jq(this);
			jq(this).find(".fj").addClass("nuw");
			jq(this).find(".zj").show();
			findLevel2();
		}
		,
		function(){
			jq(this).find(".fj").removeClass("nuw");
			jq(this).find(".zj").hide();
		}
	);
}


function leftlist() {
	$.post("goodsServlet","opr=leftlist",function(data){$(".leftNav ul").html(data);jq2();});
}
function findLevel2(){
	$.post("goodsServlet","opr=findLevel2&id="+id.attr("id"),
		function(data){
			$(".zj_l").html(data.split(",")[1]);
			id2=data.split(",")[0];
			id3=id2.split(":");
			for(i=0;i<id3.length;i++){
				i4 = id.attr("id");
				i2 = i; 
				$.ajaxSettings.async = false;
				$.post("goodsServlet","opr=findLevel3&id="+id3[i],function(data){$("#"+i4).find("#id"+i2).append("");$("#"+i4).find("#id"+i2).append(data);});
			}
		});
}
function findLevel3(){
	
}
function NewsTop5() {
	$.post("goodsServlet","opr=NewsTop5",function(data){$(".inews ul").append(data);});
}
/*function buyCar(){
	$.post("BuyCarServlet","opr=buyCarlist&page=ajax",function(data){
		var data=JSON.parse(data);
		$(".cars").html();
		var price=0;
		$(data).each(function(i){
			$(".cars").append("<li><div class='img'><a href='#'><img src='images/"+this.fileName+"' width='58' height='58' /></a></div><div class='name'><a href='#'>"+this.productName+"</a></div><div class='price'><font color='#ff4e00'>￥"+this.cost+"</font> X"+this.quantity+"</div></li>");
			price+=this.cost;
		});
		$.post("BuyCarServlet","opr=count",function(data){
			$(".car_t").html("购物车 [ <span >"+data+"</span> ]");
		});		
		$(".price_sum").html("共计&nbsp; <font color='#ff4e00'>￥</font><span>"+price+"</span>");
		$(".price_a").html("<a href='UserServlet?opr=Verification&page=one&sql=insert'>去购物车结算</a>");
	});
}*/


